<template>  
    <view>
        <!-- #ifdef MP-WEIXIN --> 
        <block v-if="tabb == 'share'">
             <top-nav :inner-title="title" is-show-back="true" is-fixed="true" :navH="navH" :n="n" is-white="bg-white" opacity="1" pagesURL="orderInfo"></top-nav>
        </block>
        <block v-else>
             <top-nav :inner-title="title" is-show-back="true" is-fixed="true" :navH="navH" :n="n" is-white="bg-white" opacity="1" pagesURL="orderInfo"></top-nav>
        </block>
        <view  :style="{height:navH + 'px'}"></view>
          <!-- #endif -->
        <block v-if="!showNoRight">
            <view class='content'>
                <view class='address'>
                    <view class="status-view " :class="orderInfo.service_type > 0 ? 'round' : ''" > 
                        <view class="right-red flex">
                            <text class="title">取餐号</text>
                            <text class="num" v-if="orderInfo.order_num > 0">{{orderInfo.order_num}}</text>
                            <text class="num_load" v-else>获取中....</text>
                        </view>
                        <view :class="orderInfo.status == 8 || orderInfo.status == 10 ? 'red' : ''">
                            <block v-if="orderInfo.status == 1">
                                <text>已成功下单</text>
                            </block>
                            <block v-if="orderInfo.status == 4">
                                <text>商家已接单</text>
                            </block>
                            <block v-if="orderInfo.status == 11 || orderInfo.status == 5 || orderInfo.status == 9 ">
                                <block v-if=" orderInfo.service_type == 0 "> 
                                    <text>商品已送出</text>
                                </block>
                                <block v-if=" orderInfo.service_type == 1 || orderInfo.service_type == 2 "> 
                                    <text>商品待取餐</text>
                                </block>
                            </block>
                            <block v-if="orderInfo.status == 7">
                                <text>订单已完成</text>
                            </block>
                            <block v-if="orderInfo.status == 8">
                                <text>商家接单超时</text>
                            </block>
                            <block v-if="orderInfo.status == 6">
                                <text>订单已取消</text>
                            </block>
                            <block v-if="orderInfo.status == 10">
                                <text>订单异常中</text>
                            </block>
                            <!---团购状态-->
                        
                            <block v-if="orderInfo.status == 21 || orderInfo.status == 20">
                                <text>等待开车</text>
                            </block>
                            <block v-if="orderInfo.status == 22">
                                <text>开车成功</text>
                            </block>
                            <block v-if="orderInfo.status == 23">
                                <text>开车失败</text>
                            </block>
                            <block v-if="orderInfo.status == 24">
                                <text>开车成功</text>
                            </block>
                            <block v-if="orderInfo.status == 25">
                                <text>商品已送出</text>
                            </block>
                            <block v-if="orderInfo.status == 26">
                                <text>订单已完成</text>
                            </block>
                            <block v-if="orderInfo.status == 27">
                                <text>订单已取消</text>
                            </block>
                        </view>
                        
                    </view>
                    <view class="status-manager" v-if="orderInfo.group_no == 0">
                    <!-- 配送 -->
                        <block v-if=" orderInfo.service_type == 0 ">   
                            <block>
                                <view class="steps">
                                    <view class="status_time">{{orderInfo.pay_time}}</view>
                                    <view class="dot_content">
                                        <view class="dot_line"></view>
                                        <view class="dot_round" :class=" orderInfo.pay_time != '00:00' ? 'black' : 'gray' "></view>
                                        <view class="dot_line" :class=" orderInfo.store_begin_time != '00:00' || orderInfo.cancel_time != '00:00' || orderInfo.finish_time != '00:00' ? 'black' : 'gray' "></view>
                                    </view>
                                    <view class="status">用户下单</view>
                                </view>
                            </block>

                            <block v-if=" orderInfo.cancel_time == '00:00' ">
                                <view  class="steps">
                                    <view class="status_time">{{ orderInfo.store_begin_time == '00:00' ? '' : orderInfo.store_begin_time }}</view>
                                    <view class="dot_content">
                                        <view class="dot_line" :class=" orderInfo.store_begin_time != '00:00' ? 'black' : 'gray' "></view>
                                        <view class="dot_round" :class=" orderInfo.store_begin_time != '00:00' ? 'black' : 'gray' "></view>
                                        <view class="dot_line" :class=" orderInfo.dispatch_time != '00:00'  || orderInfo.cancel_time != '00:00' || orderInfo.finish_time != '00:00' ? 'black' : 'gray' "></view>
                                    </view>
                                    <view class="status">商家接单</view>
                                </view>
                            </block>
                            <!-- <block wx:if="{{orderInfo.status == 11 || orderInfo.status == 5 || orderInfo.status == 9 }}"> -->
                            <!-- <block wx:if="{{ orderInfo.cancel_time == '00:00' }}">
                                <view class="steps">
                                    <view class="status_time">{{ orderInfo.store_end_time == '00:00' ? '' : orderInfo.store_end_time }}</view>
                                    <view class="dot_content">
                                        <view class="dot_line {{ orderInfo.store_end_time != '00:00' ? 'black' : 'gray' }}"></view>
                                        <view class="dot_round {{ orderInfo.store_end_time != '00:00' ? 'black' : 'gray' }}"></view>
                                        <view class="dot_line {{ orderInfo.dispatch_time != '00:00' || orderInfo.finish_time != '00:00' || orderInfo.cancel_time != '00:00' ? 'black' : 'gray' }}"></view>
                                    </view>
                                    <view class="status">商品送出</view>
                                </view>
                            </block> -->

                            <block v-if=" orderInfo.cancel_time == '00:00' && !(orderInfo.dispatch_time == '00:00' && orderInfo.finish_time != '00:00') ">
                                <view class="steps">
                                    <view class="status_time">{{ orderInfo.dispatch_time == '00:00' ? '' : orderInfo.dispatch_time }}</view>
                                    <view class="dot_content">
                                        <view class="dot_line" :class=" orderInfo.dispatch_time != '00:00' ? 'black' : 'gray' "></view>
                                        <view class="dot_round" :class=" orderInfo.dispatch_time != '00:00' ? 'black' : 'gray' "></view>
                                        <view class="dot_line" :class=" orderInfo.finish_time != '00:00'  || orderInfo.cancel_time != '00:00' ? 'black' : 'gray' "></view>
                                    </view>
                                    <view class="status">骑手配送</view>
                                </view>
                            </block>
                            
                            <block v-if=" orderInfo.cancel_time == '00:00' ">
                                <view class="steps">
                                    <view class="status_time">{{ orderInfo.finish_time == '00:00' ? '' : orderInfo.finish_time }}</view>
                                    <view class="dot_content">
                                        <view class="dot_line" :class="orderInfo.finish_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_round" :class="orderInfo.finish_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_line"></view>
                                    </view>
                                    <view class="status">订单完成</view>
                                </view>
                            </block>
                            <block v-if="orderInfo.cancel_time != '00:00'">
                                <view class="steps">
                                    <view class="status_time">{{ orderInfo.cancel_time == '00:00' ? '' : orderInfo.cancel_time }}</view>
                                    <view class="dot_content">
                                        <view class="dot_line" :class="orderInfo.cancel_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_round" :class="orderInfo.cancel_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_line"></view>
                                    </view>
                                    <view class="status">订单取消</view>
                                </view>
                            </block>
                        </block>
                    <!-- 自取 -->
                        <block v-if="orderInfo.service_type == 1 || orderInfo.service_type == 2 ">  
                            <block>
                                <view class="steps">
                                    <view class="status_time">{{orderInfo.pay_time}}</view>
                                    <view class="dot_content">
                                        <view class="dot_line"></view>
                                        <view class="dot_round" :class=" orderInfo.pay_time != '00:00' ? 'black' : 'gray' "></view>
                                        <view class="dot_line" :class=" orderInfo.store_begin_time != '00:00' || orderInfo.cancel_time != '00:00' || orderInfo.finish_time != '00:00' ? 'black' : 'gray' "></view>
                                    </view>
                                    <view class="status">用户下单</view>
                                </view>
                            </block>

                            <block v-if=" orderInfo.cancel_time == '00:00' ">
                                <view  class="steps">
                                    <view class="status_time">{{ orderInfo.store_begin_time == '00:00' ? '' : orderInfo.store_begin_time }}</view>
                                    <view class="dot_content">
                                        <view class="dot_line" :class=" orderInfo.store_begin_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_round" :class=" orderInfo.store_begin_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_line" :class=" orderInfo.finish_time != '00:00' || orderInfo.cancel_time != '00:00' ? 'black' : 'gray' "></view>
                                    </view>
                                    <view class="status">商家接单</view>
                                </view>
                            </block>
                            <block v-if=" orderInfo.cancel_time == '00:00' ">
                                <view class="steps">
                                    <view class="status_time">{{ orderInfo.finish_time == '00:00' ? '' : orderInfo.finish_time }}</view>
                                    <view class="dot_content">
                                        <view class="dot_line" :class="orderInfo.finish_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_round" :class="orderInfo.finish_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_line"></view>
                                    </view>
                                    <view class="status">订单完成</view>
                                </view>
                            </block>
                            <block v-if=" orderInfo.cancel_time != '00:00' ">
                                <view class="steps">
                                    <view class="status_time">{{ orderInfo.cancel_time == '00:00' ? '' : orderInfo.cancel_time }}</view>
                                    <view class="dot_content">
                                        <view class="dot_line" :class="orderInfo.cancel_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_round" :class="orderInfo.cancel_time != '00:00' ? 'black' : 'gray'"></view>
                                        <view class="dot_line"></view>
                                    </view>
                                    <view class="status">订单取消</view>
                                </view>
                            </block>
                        </block>
                        
                        

                        
                        <!-- <block wx:if="{{orderInfo.status == 8}}">
                            <view class="status">商家接单超时</view>
                        </block> -->
                        <!-- <block wx:if="{{orderInfo.status == 6}}">
                            <view class="status">订单已取消</view>
                        </block> -->
                        <!-- <block wx:if="{{orderInfo.status == 10}}">
                            <view class="status">订单异常中</view>
                        </block> -->
                        <!--团购状态-->
                        <block v-if=" orderInfo.group_no != 0 ">
                            <block v-if="orderInfo.status == 20">
                                <view class="status">加入成功</view>
                            </block>
                            <block v-if="orderInfo.status == 21">
                                <view class="status">等待开车</view>
                            </block>
                            <block v-if="orderInfo.status == 22">
                                <view class="status">开车成功</view>
                            </block>
                            <block v-if="orderInfo.status == 23">
                                <view class="status">开车失败</view>
                            </block>
                            <block v-if="orderInfo.status == 24">
                                <view class="status">开车成功</view>
                            </block>
                            <block v-if="orderInfo.status == 25">
                                <view class="status">商品已送出</view>
                            </block>
                            <block v-if="orderInfo.status == 26">
                                <view class="status">订单已完成</view>
                            </block>
                            <block v-if="orderInfo.status == 27">
                                <view class="status">订单已取消</view>
                            </block>
                        </block>
                        <!--团购状态-->
                        <!-- <view class="status-info">
                            <view class="left">
                                <block wx:if="{{storeInfo.address != ''}}">
                                    <text>{{storeInfo.address}}</text>
                                </block>
                            </view>
                            <block wx:if="{{orderInfo.status > 1 && orderInfo.status != 6}}">
                                <view class="right">
                                    <text>取餐号</text>
                                    <text>{{orderInfo.order_num}}</text>
                                </view>
                            </block>
                        </view> -->
                        <!-- <view class="status-button" wx:if="{{orderInfo.group_no <= 0}}">
                            <view bindtap='goStore' class="green"><text>再来一单</text></view>
                        </view> -->
                    </view>
                    <view v-if=" orderInfo.send_time != 0 " class="get_time">预计 <text>{{orderInfo.send_time}}</text> {{ orderInfo.service_type == 0 ? '送达' : '自取' }}</view>
                     <block v-if=" orderInfo.group_no != 0 ">
                        <view v-if=" finish_time != 0 " class="get_time">预计 <text>{{finish_time}}</text> 送达</view>
                     </block>
                    <view class="status-button contact flex">
                        <view class="gray flex_1" @click='byPhone()' v-if="orderInfo.status == 1 || orderInfo.status == 8">
                            取消订单
                        </view>
                        <view class="gray flex_1" @click='byPhone()'>
                            <text class='icon'></text>
                            <text>联系商家</text>
                        </view>
                        <block  v-if="ridInfo.mobile">
                            <view class="gray flex_1" :data-phone="ridInfo.mobile" @click="ridPhone($event)">
                                <text class='icon'></text>
                                <text>联系骑手</text>
                            </view>
                       </block>
                        <block v-if=" is_comment == 1 && is_over == 0 && (orderInfo.status == 26 || orderInfo.finish_time != '00:00')">
                            <view class="green green_bg" @click="goComment()">
                                评价
                            </view>
                        </block>
                        <block v-if="group_id > 0">
                            <button class="gray" open-type="share" data-id="0">分享账单</button>
                       </block>
                    </view>
                    
                </view>
                <!-- <block wx:if="{{ridInfo.mobile}}">
                    <view class="rid-info" data-phone="{{ridInfo.mobile}}" bindtap="ridPhone">
                        <view class="rid-left">
                            <image src="{{ridInfo.face}}"></image>
                            <view>{{ridInfo.nickname}}</view>
                            <text>配送达人</text>
                        </view>
                        <view class="rid-right">
                            <image src="http://juhuijia2.birdback.org/mapi/i/wode_dianhua@3x.png"></image>
                        </view>
                    </view>
                </block> -->
                <view class='buy-info'>
                    <view class='title_out'>
                        <view class="title" @click='openStore($event)' :data-storeid='storeInfo.id' :data-servicetype="orderInfo.service_type">
                            <image class='icon' :src='storeInfo.icon'></image>
                            <view class='text'>{{storeInfo.shop_name}}</view>
                            <icon class="arr_right"></icon>
                        </view>
                        <view class="status-button get_oneself" v-if=" storeInfo.open_oneself != 0 ">
                            <view class="green"><text>支持自取</text></view>
                        </view>
                    </view>
                    <!-- 拼单列表 -->
                    <block v-if="group_id > 0">
                        <view class="buy_together_content">
                            <view class="buy_together_out">
                                <view class='buy_together' v-for="(item,index) in groupList" :key="index"  :style='{display: (!showMore && index == 0) || showMore ? "block" : "none" }'>
                                    <view class="list_head title flex_Row">
                                        <image class='face' :src="item.face"></image>
                                        <text class="nickname ellipsis">{{item.nickname}}</text>
                                        <text class="tips" v-if="index == 0">(我)</text>
                                    </view>
                                    <view class='buy-list'>
                                        <block v-for='(item,index) in item.goods_list' :key="item.id">
                                            <view class='item'>
                                                <view class='item-left'>
                                                    <image :src='item.img_path'></image>
                                                </view>
                                                <view class='item-right'>
                                                    <view class='name'>
                                                        <view class='text'>{{item.name}}</view>
                                                        <view class='price'>￥{{item.money}}</view>
                                                    </view>
                                                    <view class='setting'>{{item.showDesc}}</view>
                                                    <view class='num'>x{{item.num}}</view>
                                                </view>
                                            </view>
                                        </block>
                                    </view>
                                    <view class='buy-detail settlement'>
                                        <view class='buy-detail-item' v-if="item.money_list.food_box_money > 0 ">
                                            <view class='text'>包装费</view>
                                            <view class='price'>￥{{item.money_list.food_box_money}}</view> 
                                        </view>
                                        <view class='buy-detail-item' v-if="item.money_list.delivery > 0 ">
                                            <view class='text'>配送费</view>
                                            <view class='price'>￥{{item.money_list.delivery}}</view>
                                        </view>
                                        <view class='buy-detail-item' v-if=" item.money_list.discounts > 0 ">
                                            <view class='text'>优惠合计</view>
                                            <view class='price sum'><text>-￥{{item.money_list.discounts}}</text></view>
                                        </view>
                                        <view class='buy-detail-item'>
                                            <view class='text'>计算规则 <view class="tips_question" @click="showTip()"></view></view>
                                            <view class='price sum'>小计 <text>￥{{item.money}}</text></view>
                                        </view>
                                    </view>
                                
                                </view>
                            </view>
                            <block v-if=' totalCount > 1 '>
                                <view class='share_more button' @click='showMoreEvent()'>
                                    <text>{{ showMore ? '点击收起' : '展示更多' }}</text>
                                    <icon :class='showMore ? "ck" : ""'></icon>
                                </view>
                            </block>
                        
                        </view>
                    </block>
                    <!-- 普通订单 -->
                    <block v-else>
                        <view class='buy-list' :style='{height: goodsList.length > 3 && !showMore ? "507rpx" : ""}'>
                            <block v-for='(item,index) in goodsList' :key="index" >
                                <view class='item'>
                                    <view class='item-left'>
                                        <image :src='item.icon'></image>
                                    </view>
                                    <view class='item-right'>
                                        <view class='name'>
                                            <view class='text'>{{item.name}}</view>
                                            <view class='price'>￥{{item.price}}</view>
                                        </view>
                                        <view class='setting'>{{item.showDesc}}</view>
                                        <view class='num'>x{{item.num}}</view>
                                    </view>
                                </view>
                            </block>
                        </view>
                        <block v-if='goodsList.length > 3'>
                            <view class='share_more button' @click='showMoreEvent()'>
                                <text>{{ showMore ? '点击收起' : '展示更多' }}</text>
                                <icon :class='showMore?"ck":""'></icon>
                            </view>
                        </block>
                    </block>
                    <view class='buy-detail'>
                        <view class='buy-detail-item'>
                            <view class='text'>包装费</view>
                            <view class='price'>￥{{ packageFee }}</view>
                        </view>
                        <view class='buy-detail-item' v-if=" orderInfo.service_type == 0 "  style="border-top: 1px solid rgba(0, 0, 0, 0.08);">
                            <view class='text'>配送费</view>
                            <view class='price'>￥{{storeInfo.send_price}}</view>
                        </view>
                        <block v-if='mPrice >  0'>
                            <view class='buy-detail-item'>
                                <view class='youhui'>
                                    <view class='cut_icon'>减</view>
                                    <text>满减优惠</text>
                                </view>
                                <view class='youhui-price'>-￥{{mPrice}}</view>
                            </view>
                        </block>
                        <block v-if='zkPrice > 0'>
                            <view class='buy-detail-item'>
                                <view class='youhui'>
                                    <view class='discount'></view>
                                    <text>折扣优惠</text>
                                </view>
                                <view class='youhui-price'>-￥{{zkPrice}}</view>
                            </view>
                        </block>
                        <block v-if='orderInfo.reduction_sale > 0'>
                            <view class='buy-detail-item'>
                                <view class='youhui'>
                                    <view class='cut_icon'>¥</view>
                                    <text>红包优惠</text>
                                </view>
                                <view class='youhui-price'>-￥{{orderInfo.reduction_sale}}</view>
                            </view>
                        </block>
                        <view class='settlement'>
                            <view class='settlement-box'>
                                <view class='wz'>
                                    <block v-if='yhPrice > 0'>
                                        <view class='youhui'>已优惠￥{{yhPrice}}</view>
                                    </block>
                                    <view class='sum'>
                                        实付
                                        <text>￥{{payPrice}}</text>
                                    </view>
                                </view>
                                <view class="status-button contact no_out customService">
                                    <button class="green" open-type="contact">
                                        <text class='icon'></text>
                                        联系客服
                                    </button>
                                </view>
                            </view>
                        </view>
                        <!-- <view class='bar'>
                            <view class='icon'></view>
                            <view class='text' bindtap='byPhone'>联系商家</view>
                        </view> -->
                    </view>

                </view>
                <view class='fujia comment' v-if="is_comment == 0">
                   <view class='option' @click="goMyComment()">
                       <view class='item'>
                           <text>我的评价</text>
                           <icon class="arr_right"></icon>
                       </view>
                   </view>
                </view>

                <view class='fujia'>
                    <view class='option'>
                        <view class='item'>
                            <text class="ti">配送信息</text>
                        </view>
                    </view>
                    <view class='option'>
                        <view class='item'>
                            <view>
                                <text>期望时间</text>
                            </view>
                            <text v-if=" orderInfo.group_no != 0 ">{{finish_time}}</text>
                            <text v-else-if="orderInfo.send_time != 0">{{orderInfo.send_time}}</text>
                            <text v-else> {{ orderInfo.service_type >0 ? '即刻取餐' : ' 尽快送达' }} </text>
                        </view>
                    </view>
                    <view class='option' v-if="orderInfo.service_type==0">
                        <view class='item'>
                            <view>
                                <text>配送地址</text>
                            </view>
                            <view class="add">
                                <block v-if="orderInfo.address && orderInfo.addr_name && orderInfo.addr_sex && orderInfo.addr_phone">
                                    {{orderInfo.addr_name}}({{orderInfo.addr_sex}}）{{orderInfo.addr_phone}}
                                    {{orderInfo.address}}
                                </block>
                                
                            </view>
                        </view>
                    </view>
                    <view class="option" v-else>
                        <view class="item">
                            <view>
                                <text>取餐地址</text>
                            </view>
                            <block v-if="storeInfo.address != ''">
                                <text>{{storeInfo.address}}</text>
                            </block>
                        </view>
                    </view>
                </view>
                <view class='fujia'>
                    <view class='option'>
                        <view class='item'>
                            <text class="ti">订单信息</text>
                        </view>
                    </view>
                    <view class='option'>
                        <view class='item'>
                            <view>
                                <text>订单号码</text>
                            </view>
                            <text>{{orderInfo.order_no}}</text>
                        </view>
                    </view>
                    <view class='option'>
                        <view class='item'>
                            <view>
                                <text>订单时间</text>
                            </view>
                            <text>{{orderInfo.add_time}}</text>
                        </view>
                    </view>
                    <view class='option'>
                        <view class='item'>
                            <view>
                                <text>支付方式</text>
                            </view>
                            <text>在线支付</text>
                        </view>
                    </view>
                    <view class='option' v-if=" orderInfo.service_type > 0 && orderInfo.is_pack ">
                        <view class='item'>
                            <view>
                                <text>堂食打包</text>
                            </view>
                            <text>{{ orderInfo.is_pack == 1 ? '堂食' : '打包' }}</text>
                        </view>
                    </view>
                    <view class='option' v-if="orderInfo.remark && orderInfo.remark != '' ">
                        <view class='item'>
                            <view>
                                <text>订单备注</text>
                            </view>
                            <text>{{orderInfo.remark}}</text>
                        </view>
                    </view>
                    <!-- <view class='option'>
                        <view class='item'>
                            <view>
                                <text>餐具数量</text>
                            </view>
                            <text>在线支付</text>
                        </view>
                    </view> -->
                </view>
                <view class='box'></view>
                <!--弹窗-->
            </view>
       
        </block>
        <block v-else>
            <view class='noRight_out'>
                <view class="noRight">
                    抱歉，您未参与当前拼单，无法查看订单详情
                </view>
                <view class="bt" @click='toIndex()'>去首页点餐</view>
            </view>   
        </block>
        
<!-- #ifdef MP-WEIXIN -->         
        <block v-if="groupText != '' && from != ''">
            <!-- <block> -->
                <view class="group-share-box">
                    <view class="group-share-mask" @touchmove.stop.prevent="moveHandle"></view>
                    <view class="group-view">
                        <!-- <image src="http://img1.birdback.org/a/be/e1/bee1d77f96b661af8ee0cbbd78b74ee0.png"></image> -->
                        <icon class='cancel_icon' @click="groupCancelEvent()"></icon>
                        <view class='group_inner'>
                            <text>{{groupText}}</text>
                            <button open-type="share" class="group-enter" data-id="1"></button>  
                            <!--<view class="group-button">
                                 <button class="group-cancel" bindtap="groupCancelEvent">取消</button> 
                            </view>-->
                        </view>
                    </view>
                </view>
        </block>
        <button class="red_packet" @click="openPacket()" v-if="!packetShareBox && rp_id != 0">
            <image src="http://img1.birdback.org/a/81/dd/81ddee15b38fca2c80f2cce0d9547ad1.png"></image>
        </button>
        <block v-if="packetShareBox && rp_id != 0">
            <view class="group-share-box">
                <view class="group-share-mask" @touchmove.stop.prevent="moveHandle"></view>
                <view class="packet_share">
                    <view class="packet_share_view">
                        <image src="http://img1.birdback.org/a/b5/cf/b5cfc80ee0d49fa3726493f4e1fa165a.png"></image>
                            <view class="black_text">送您一个拼手气红包</view>
                            <view class="gray_text">快分享给小伙伴看看谁会撞大运</view>
                    </view>
                    <view class="group-button bottom flex_Row">
                        <button class="black_text" hover-class="none" @click="hidePacket()">取消</button>
                        <button class="red_text" hover-class="none" open-type="share" data-id="2">发红包</button>
                    </view>
                </view>
            </view>
        </block>
            

<!-- #endif -->
            <view class='group-detail-box' v-if="showRule">
                <view class="group-mask"></view>
                <view class="group-detail-medium">
                    <view class='list bg'>  
                        <view class="group-detail-title">优惠计算规则</view>
                        <view class="group-item">
                            1.满减优惠金额等活动，根据每位拼友选购的商品价格，按金额比例分摊给每位拼友。
                            2.折扣菜/第二份半价菜优惠金额，根据每位拼友选购的商品原价，按金额比例分摊给每位拼友。
                        </view>
                        <view class="group-detail-title">配送费计算规则</view>
                        <view class="group-item">
                            配送费只按照1笔订单收取，根据每位拼友选购的商品价格，按金额比例分摊给每位拼友。
                        </view>
                        <view class="group-detail-title">包装费计算规则</view>
                        <view class="group-item">
                            包装费根据每位拼友的选购商品分别进行计算，不会进行平均分配。
                        </view>
                    </view>
                    <view class='close_together' @click='closeShowRule()'>
                    </view>
                </view>
        </view>

    </view>
</template>

<script>
    import uniFly from 'unifly';
	import request from '../../common/request.js';
	import $api_base from '../../api/api_base.js';
    import Big from '../../common/big.js';
	import topNav from '@/template/topnav/index.vue';
    var schoolId = 0;
	export default {
		components: { topNav },
		data() {
			return {
				n: 0,
                openId:'',
                storeId: 0,
                storeInfo: [],
                goodsList: [],
                orderInfo: [],
                ridInfo: [],
                showMore: false,
                mPrice: 0,
                yhPrice: 0,
                payPrice: 0, //最后支付价格
                phone: '',
                groupText: '',
                from: '',
                tabb:'',
                showGroupRule:false,
                navH:0,
                title: '订单详情',
                finish_time: '',
                group_id:"0",      //拼单id，0表示不是拼单
                totalCount:0,
                showRule:false,
                orderNo:'',
                showNoRight: false,
                timer:'',
                packageFee:0,
                groupList:[],
                packetShareBox: false,
                rp_id:0,
                showBtMore: false,
                is_comment:0,
                is_over:0,
                lucky:0
			}
		},
		onLoad: function (options) {
            console.log(options);
            this.navH    = getApp().globalData.navHeight;
            this.n       = getApp().globalData.n;
            var orderNo  = options.order_no || '1542893430082933668';
            var from     = options.from || ' ';
            var group_id = options.group_id || 0;
            var tabb     = options.tabb || ' ';
            getApp().globalData.schoolId = options.schoolId || getApp().globalData.schoolId;
            schoolId      = getApp().globalData.schoolId;
            var self      = this;
            self.rp_id     = options.rp_id || 0;
            self.navH     = getApp().globalData.navHeight; 
            self.orderNo  = orderNo;
            self.from     = from;
            self.openId   = uni.getStorageSync('openid');
            self.tabb     = tabb;
            self.group_id = group_id;
            self.loadOrderInfo();
		},
		methods:{
            openPacket: function(){
                this.packetShareBox = true;
            },
            hidePacket: function(){
                this.packetShareBox = false;
            },
            groupCancelEvent: function () {
                this.groupText = '';
            },
            showMoreEvent: function () {
                if (this.showMore) {
                    this.showMore = false;
                } else {
                    this.showMore = true;
                }
            },
            goStore: function () {
                var servicetype = this.orderInfo.service_type;
                uni.navigateTo({
                    url: '/pages/goods/goods?storeId=' + this.storeId + '&sid=order_detail' + '&schoolId=' + schoolId + '&servicetype=' + servicetype
                })
            },
            getOrderNum: function(){
                var self = this;
                var orderNo = self.orderNo;
                var from = self.from;
                var timer = '';
                $api_base.post($api_base.getOrderByidV3,{ order_no: orderNo, from: from },1).then(function (res) {
                    let data = res.data;
                    if (data.ok == 1) {
                        var orderInfo = data.order_info || []; 
                        self.orderInfo= orderInfo;
                        if (orderInfo.order_num == 0) {
                            timer =  setTimeout(function () { self.getOrderNum(); }, 500);
                            self.timer = timer;
                        }
                    }
                });
            },
            byPhone: function (e) {
                var phone = this.phone;
                uni.makePhoneCall({
                    phoneNumber: phone
                })
            },
            ridPhone: function (e) {
                var phone = e.currentTarget.dataset.phone;
                uni.makePhoneCall({
                    phoneNumber: phone
                })
            },
            goComment: function(){
                var self = this;
                uni.navigateTo({
                    url:'/pagesOther/comment/index?order_no=' + self.orderNo + '&storeId=' + self.storeId + '&serviceType=' + self.orderInfo.service_type,
                })
            },  
            goMyComment: function(){
                var self = this;
                 uni.navigateTo({
                    url:'/pagesOther/comment/my-comment/index?order_no=' + self.orderNo + '&storeId=' + self.storeId,
                })
            },
            onShareAppMessage: function (e) {
                var sid      = '';
                var self     = this;
                var dataid   = '';
                var shareImg = this.storeInfo.share_icon || this.storeInfo.home_default;
                var tabb     = '';
                var group_id = self.group_id;
                if(e.from == "menu"){
                    dataid = group_id > 0 ? 0 : 1  
                }else{
                    dataid = e.target.dataset.id;
                }
                if (this.from === 'group') {
                    sid = 'share_group';
                }
                if(dataid == 0){
                    tabb = 'share';
                    return {
                        title: '拼单账单：已为每人计算好活动优惠和配送费',
                        path: '/pagesGoods/order-info/index?order_no=' + self.orderNo + '&group_id=' + group_id + '&tabb=' + tabb + '&schoolId=' + schoolId,
                        imageUrl: shareImg,
                        success: function (res) {
                            // 转发成功
                            self.groupText = '';
                        },
                        fail: function (res) {
                            // 转发失败
                        }
                    }
                } else if ( dataid == 1 ){     // 下完单后分享
                    return {
                        title: this.storeInfo.shop_name,
                        path: '/pages/goods/goods?storeId=' + self.storeId + '&sid=' + sid + '&schoolId=' + schoolId,
                        imageUrl: shareImg,
                        success: function (res) {
                            // 转发成功
                            self.groupText = '';
                        },
                        fail: function (res) {
                            // 转发失败
                        }
                    }
                }else  if ( dataid == 2 ){
                    self.hidePacket();
                    return {
                        title: '【同学快跑】第'+self.lucky+'个领取的人得大红包!',
                        path: '/pages/red-packet/share-packet/index?rp_id=' +self.rp_id,
                        imageUrl: 'http://img1.birdback.org/a/de/b1/deb1b89474be0fbbdcb95d5901d576af.png',
                        success: function (res) {
                            // 转发成功
                             self.hidePacket()
                        },
                        fail: function (res) {
                            // 转发失败
                        }
                    }
                }
            },
            openStore: function (e) {
                var storeId = e.currentTarget.dataset.storeid;
                var servicetype = e.currentTarget.dataset.servicetype;
                uni.navigateTo({
                    url: '/pages/goods/goods?storeId=' + storeId + '&sid=index' + '&schoolId=' + schoolId + '&servicetype=' + servicetype
                })
            },
			showTip: function () {
                this.showRule = true;
            },
            closeShowRule: function(){
                this.showRule = false;
            },
            toIndex:function(){
                uni.switchTab({
                	url: '/pages/index/index'
                });
            },
            loadOrderInfo: function(){
               
                var self = this;
                var orderNo = self.orderNo;
                var from = self.from;
                var mPrice = 0;   //满减优惠
                var payPrice = 0;   //支付价格
                var yhPrice = 0;   //总优惠
                var zkPrice = 0;
                var timer = '';
                var mgroupList = [];
                $api_base.post($api_base.getOrderByidV3,{ order_no: orderNo, from: from }).then(function (res) {
                    let data = res.data;
                    if (data.ok == 1) {
                        var carList = data.car_list || [];
                        var storeInfo = data.store_info || [];
                        var orderInfo = data.order_info || [];
                        var ridInfo = data.rid_info || [];
                        var groupText = data.group_text || '';
                        var finish_time = data.finish_time || '尽快送达';
                        var isOld = false;
                        var packageFee = 0;
                        if (data.group_id == "0") {
                            var goodsList = carList.goods_list || [];
                            mPrice = carList.m_price;
                            yhPrice = carList.yh_price;
                            payPrice = orderInfo.real_price;
                            zkPrice = carList.zk_price;
                            packageFee = carList.food_box_money + carList.package_bag_money;
                            packageFee = Big(packageFee).round(2).toString();
                            self.goodsList = goodsList;
                        } else {
                            mgroupList = data.car_list || [];
                            var totalCount = 0;
                            payPrice = data.order_info.real_price;
                            for (let i in mgroupList) {
                                totalCount += mgroupList[i].goods_list.length;
                                if (mgroupList[i].wxapp_id == self.openId){
                                    isOld = true;
                                }
                            }
                            if(!isOld){
                                self.showNoRight = true;
                                return
                            }
                            mPrice          = data.group_money.m_price || 0;
                            yhPrice         = data.group_money.yh_price || 0;
                            payPrice        = data.group_money.result_price || 0;
                            zkPrice         = data.group_money.zk_price || 0;
                            packageFee      = (data.group_money.food_box_money + data.group_money.package_bag_money) || 0;
							packageFee      = Big(packageFee).round(2).toString();
                            self.groupList  = mgroupList;
                            self.totalCount = totalCount;
                            self.packageFee = packageFee;
                        }
                        self.storeId   = storeInfo.id;
                        self.storeInfo = storeInfo;
                        self.orderInfo = orderInfo;
                        self.ridInfo   = ridInfo;
                        self.mPrice    = mPrice;
                        self.yhPrice   = yhPrice;
                        self.zkPrice   = zkPrice;
                        self.payPrice  = payPrice;
                        self.phone     = storeInfo.mobile;
                        self.groupText = groupText; 
                        self.finish_time = finish_time;
                        self.group_id  = data.group_id;
                        self.packageFee= packageFee;
                        self.is_comment= data.is_comment;
                        self.is_over   = data.is_over;
                        self.rp_id     = orderInfo.red_id || 0;
                        self.lucky     = orderInfo.lucky;
                        if(self.from == 'group'){
                            self.packetShareBox = true;
                        }
                        if (orderInfo.order_num == 0) {
                           timer = setTimeout(function () { self.getOrderNum();},500);
                            self.timer = timer;
                        }
                    }else if( data.ok == -1 ){
                       // self.loginReg();
                    }
                });
            },
		},
        onUnload: function(){
            var timer = this.timer;
            clearTimeout(timer);
        }
	}
</script>

<style>
  page {
  background-color: #fff;
  }
</style>
<style lang="scss" scoped>
	@import 'index.scss';
</style>


